let page = {
  total: 1,
  startIndex: 0,
  stepNumber: 40,
  currentPage: 1
};


let data={
  countryPostageList:[],
  countryPostageSortList:[],
  postage:{
    id:'',
    name:'',
    method:'',
    minTime:0,
    maxTime:0,
    minWeight:0,
    postageRules:[]
  },

};

let status={
  actionModal:{
    isShow:false,
    isLoading:false,
    title:'',
    content:'',
    action:'',
    operationIndex:''
  },
  showPostageDetailModal:{
    isShow:false,
    title:"",
    operationIndex:''
  }
};
let params={
  countryName:'',
  method:'',
  isNotConfig:false,
};
let  tableTitles=function (self) {
  var titles = [
    {
      title: '国家名称',
      key: 'countryCn',
      // width: 100,
      align: 'center',
      minWidth: 150,
    },
    {
      title: '国家英文名称',
      key: 'countryEn',
      // width: 100,
      align: 'center',
      minWidth: 180,
    },
    {
      title: '运费名称',
      key: 'postageName',
      width: 250,
      align: 'center',
      render: (h, params) => {
        let divChild;
        if(self.$authority('OTHER-3-202')){
          divChild = <a onClick={() => {
            self.showPostageDetail(params.index)
          }}>{params.row.postageName}</a>
        } else {
          divChild = params.row.postageName
        }
        return <div>{divChild}</div>
      }
    },
    {
      title: '英文名称',
      key: 'enName',
      // width: 100,
      align: 'center',
      minWidth: 200,
    },
    // {
    //   title: '配送方式',
    //   key: 'method',
    //   width: 120,
    //   render: (h, params) => {
    //     let methodName='尚未配置';
    //     self.$store.getters.dictionaries.postageMethodDict.forEach(
    //       function(item){
    //         if(item.value===params.row.method ){
    //           methodName = item.name;
    //           return;
    //         }
    //       }
    //     );
    //     return h("div",methodName+'快递');
    //
    //   },
    //   align: 'center'
    // },
    {
      title: '最短周期',
      key: 'minTime',
      width: 100,
      align: 'center'
    },
    {
      title: '最长周期',
      key: 'maxTime',
      width: 100,
      align: 'center'
    },
    {
      title: '操作',
      key: 'action',
      align: 'center',
      minWidth: 200,
      render: (h, params) => {
        return h('div', [
          !self.$authority('OTHER-3-202')?null:h('Button', {
            props: {type: 'info', size: 'small', icon: "md-albums"},
            style: {marginRight: '10px', marginTop: '6px', marginBottom: '3px'},
            on: {
              click: () => {
                self.showPostageDetail(params.index)
              }
            }
          }, "查看"),
          !self.$authority('OTHER-3-201')?null: h('Button', {
              props: {type: 'error', size: 'small', icon: "md-trash"},
              style: {marginRight: '10px', marginTop: '6px', marginBottom: '3px'},
              on: {
                click: () => {
                  self.delete(params.index)
                }
              }
            }, "删除 "),
          ]
        )

      },

    }
  ]

  return self.$authTableTitles(titles)
};

let sortTitles=function (self) {
  var titles = [
    {
      title: '国家名称',
      key: 'countryCn',
      // width: 100,
      align: 'center',
      minWidth: 150,
    },
    {
      title: '国家英文名称',
      key: 'countryEn',
      // width: 100,
      align: 'center',
      minWidth: 180,
    },
    {
      title: '运费名称',
      key: 'postageName',
      width: 250,
      align: 'center',

    },
    {
      title: '英文名称',
      key: 'enName',
      // width: 100,
      align: 'center',
      minWidth: 200,
    },
    {
      title: '最短周期',
      key: 'minTime',
      width: 100,
      align: 'center'
    },
    {
      title: '最长周期',
      key: 'maxTime',
      width: 100,
      align: 'center'
    }
  ]

  return self.$authTableTitles(titles)
};


export  default  {
  tPage: page,
  tStatus: status,
  tParam: params,
  tData: data,
  listTableTitles:tableTitles,
  sortTitles:sortTitles,
};
